Cadenza : Cadenza Namespace

Tuple<T1,T2> Generic Class

A strongly-typed sequence of 2 variously typed values.

public class Tuple<T1, T2>

Type Parameters

T1
The first value type.
T2
The second value type.

Remarks

A Tuple is an immutable, strongly typed sequence of variously typed values with each value lacking an otherwise meaningful name aside from its position.

Requirements

Namespace: Cadenza
Assembly: Cadenza (in Cadenza.dll)
Assembly Versions: 0.1.0.0

Members

See Also: Inherited members from object.

Public Constructors

Tuple (T1, T2)
Constructs and initializes a new Cadenza.Tuple<T1, T2> instance.

Public Properties

[read-only]
Item1 T1 . The first tuple value.
[read-only]
Item2 T2 . The second tuple value.

Public Methods

override
Equals (object) : bool
Determines whether the current instance and the specified object have the same value.
override
GetHashCode () : int
Generates a hash code for the current instance.
override
ToString () : string
Returns a string representation of the value of the current instance.

Extension Methods

static
Aggregate<T1,T2,TResult> (this Tuple<T1, T2>, Func<T1, T2, TResult>) : TResult
Converts the Cadenza.Tuple<T1, T2> into a TResult.
static
Just<T> (this T) : Maybe<T>
Create a new Cadenza.Maybe<T> instance initialized to a specified value. The returned value will not be Maybe<T>.Nothing.
static
Match<TSource,TResult> (this TSource, params Func<TSource, Maybe<TResult>>[]) : TResult
Converts the TSource instance self into a TResult.
static
Match<T1,T2,TResult> (this Tuple<T1, T2>, params Func<T1, T2, Maybe<TResult>>[]) : TResult
Converts the current Cadenza.Tuple<T1, T2> instance into a TResult.
static
ToEnumerable<T1,T2> (this Tuple<T1, T2>) : IEnumerable<object>
Converts the Cadenza.Tuple<T1, T2> into a IEnumerable<object>.
static
ToKeyValuePair<TKey,TValue> (this Tuple<TKey, TValue>) : KeyValuePair<TKey, TValue>
Converts a Cadenza.Tuple<TKey, TValue> into a KeyValuePair<TKey, TValue>.
static
ToMaybe<T> (this T) : Maybe<T>
Create a new Cadenza.Maybe<T> instance initialized to a specified value. The returned value may be Maybe<T>.Nothing.
static
TraverseBreadthFirst<TSource,TResult> (this TSource, Func<TSource, TResult>, Func<TSource, IEnumerable<TSource>>) : IEnumerable<TResult>
Traverse a tree in a breadth-first fashion, converting each encountered node.
static
TraverseBreadthFirstWithParent<TSource,TResult> (this TSource, Func<TSource, TResult>, Func<TSource, IEnumerable<TSource>>) : IEnumerable<KeyValuePair<TSource, TResult>>
Traverse a tree in a breadth-first fashion, converting each encountered node.
static
TraverseDepthFirst<TSource,TResult> (this TSource, Func<TSource, TResult>, Func<TSource, IEnumerable<TSource>>) : IEnumerable<TResult>
Traverse a tree in a depth-first fashion, converting each encountered node.
static
TraverseDepthFirstWithParent<TSource,TResult> (this TSource, Func<TSource, TResult>, Func<TSource, IEnumerable<TSource>>) : IEnumerable<KeyValuePair<TSource, TResult>>
Traverse a tree in a depth-first fashion, converting each encountered node.
static
With<TSource,TResult> (this TSource, Func<TSource, TResult>) : TResult
Supports chaining otherwise temporary values.

Member Details

Tuple Constructor

Constructs and initializes a new Cadenza.Tuple<T1, T2> instance.

public Tuple (T1 item1, T2 item2)

Parameters

item1
A T1 which is used to initialize the Tuple<T1, T2>.Item1 property.
item2
A T2 which is used to initialize the Tuple<T1, T2>.Item2 property.

Remarks

Constructs and initializes a new Cadenza.Tuple<T1, T2> instance.

Requirements

Namespace: Cadenza
Assembly: Cadenza (in Cadenza.dll)
Assembly Versions: 0.1.0.0

Equals Method

Determines whether the current instance and the specified object have the same value.

public override bool Equals (object obj)

Parameters

obj
A object to compare this instance against.

Returns

true if obj is a Cadenza.Tuple<T1, T2> and each member of obj and the current instance have the same value (according to EqualityComparer<T>.Equals(`0, `0)); otherwise false is returned.

Remarks

This method checks for value equality (EqualityComparer<T>.Equals(`0, `0)), as defined by each value type.

Note: This method overrides object.Equals(object).

Requirements

Namespace: Cadenza
Assembly: Cadenza (in Cadenza.dll)
Assembly Versions: 0.1.0.0

GetHashCode Method

Generates a hash code for the current instance.

public override int GetHashCode ()

Returns

A int containing the hash code for this instance.

Remarks

Note: This method overrides object.GetHashCode.

Requirements

Namespace: Cadenza
Assembly: Cadenza (in Cadenza.dll)
Assembly Versions: 0.1.0.0

Item1 Property

The first tuple value.

public T1 Item1 { get; }

Value

A T1 which is the first tuple value.

Remarks

The first tuple value.

Requirements

Namespace: Cadenza
Assembly: Cadenza (in Cadenza.dll)
Assembly Versions: 0.1.0.0

Item2 Property

The second tuple value.

public T2 Item2 { get; }

Value

A T2 which is the second tuple value.

Remarks

The second tuple value.

Requirements

Namespace: Cadenza
Assembly: Cadenza (in Cadenza.dll)
Assembly Versions: 0.1.0.0

ToString Method

Returns a string representation of the value of the current instance.

public override string ToString ()

Returns

A string representation of the value of the current instance.

Remarks

Operation
Returns (, followed by a comma-separated list of the result of calling object.ToString on Tuple<T1, T2>.Item1, Tuple<T1, T2>.Item2, followed by ).

Requirements

Namespace: Cadenza
Assembly: Cadenza (in Cadenza.dll)
Assembly Versions: 0.1.0.0